<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:v-on="http://www.w3.org/1999/xhtml">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="../../../../static/favicon.ico" th:href="@{/favicon.ico}">

    <link rel="stylesheet" type="text/css" href="../../../../static/bootstrap/css/bootstrap.min.css"
          th:href="@{/bootstrap/css/bootstrap.min.css}"/>
    <link rel="stylesheet" type="text/css" href="../../../../static/plugins/layui/css/layui.css"
          th:href="@{/plugins/layui/css/layui.css}"/>
    <link rel="stylesheet" type="text/css" href="../../../../static/web/admin/css/font-awesome.css"
          th:href="@{/web/admin/css/font-awesome.css}"/>
    <link rel="stylesheet" type="text/css" href="../../../../static/web/admin/css/style.css"
          th:href="@{/web/admin/css/style.css}"/>

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content" id="body">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>操作记录
                        <small>管理员操作日志</small>
                    </h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-9 m-b-xs">

                            <div class="btn-group" id="exampleToolbar" role="group">
                            </div>

                        </div>
                        <div class="col-sm-3">
                            <form method="get" th:action="@{log}" class="form-horizontal">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入关键词" class="input-sm form-control" name="search" th:value="${pageInfo.search}">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                    </span>
                                </div>
                            </form>

                        </div>
                    </div>
                    <div>
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th style="width: 150px;">操作时间</th>
                                <th>操作内容</th>
                                <th style="width: 150px;">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="item,status : ${page.content}">
                                <td th:text="${item.addTime}"></td>
                                <td th:text="${item.actionText}"></td>
                                <td>
                                    <button type="button" class="btn btn-w-m btn-white btnInfo" th:value="${item.id}">
                                        <i class="fa fa-info"></i>&nbsp;信息
                                    </button>
                                </td>
                            </tr>
                            <tr style="text-align: center;" th:if="${#lists.isEmpty(page.content)}">
                                <td colspan="3">没有更多内容</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div id="page"></div>
                </div>
            </div>
        </div>

    </div>

</div>

<script src="../../../../static/plugins/jquery.min.js" th:src="@{/plugins/jquery.min.js}" type="text/javascript"
        charset="utf-8"></script>
<script src="../../../../static/bootstrap/js/bootstrap.min.js" th:src="@{/bootstrap/js/bootstrap.min.js}"
        type="text/javascript" charset="utf-8"></script>
<script src="../../../../static/plugins/layui/layui.js" th:src="@{/plugins/layui/layui.js}" type="text/javascript"
        charset="utf-8"></script>
<script src="../../../../static/web/admin/js/content.js" th:src="@{/web/admin/js/content.js}" type="text/javascript"
        charset="utf-8"></script>

<script th:inline="javascript">
    /*<![CDATA[*/
    layui.use(['layer', 'laypage', 'laydate'], function () {
        layui.laypage.render({
            elem: "page",
            count: /*[[${page.totalElements}]]*/0,
            limit: /*[[${pageInfo.size}]]*/10,
            curr: /*[[${pageInfo.page}]]*/1,
            groups: 10,
            jump: function (obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                var search = getQueryString("search");
                if (search !== null) {
                    search = "&search=" + search;
                } else {
                    search = "";
                }
                if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                    window.location.href = "./log?page=" + curr + search;
                }
            }
        });
        $(".btnInfo").click(function () {
            var logId = $(this).val();
            var index = layui.layer.open({
                type: 2,
                title: '日志信息',
                area: ['480px', '480px'],
                content: "./log/" + logId
            });
        });

    });

    /*]]>*/
</script>
</body>

</html>